package com.yxplearn.mybatisplus.dao.entry;

import com.yxplearn.mybatisplus.dao.annotation.EntryMap;
import com.yxplearn.mybatisplus.dao.annotation.PropertiesMap;
import com.yxplearn.mybatisplus.dao.core.AbstractPojo;

@EntryMap(table = "user")
public class UserPojo extends AbstractPojo {

    @PropertiesMap(column = "id", primaryKey = true)
    private long id;
    @PropertiesMap(column = "name")
    private String name;
    @PropertiesMap(column = "age")
    private int age;
    @PropertiesMap(column = "email")
    private String email;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public UserPojo build(String name, int age, String email) {
        UserPojo user = new UserPojo();
        user.setEmail(email);
        user.setName(name);
        user.setAge(age);
        return this;
    }

    @Override
    public int getPrimaryKey() {
        return 0;
    }

    @Override
    public String toString() {
        return "UserPojo{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", email='" + email + '\'' +
                '}';
    }
}
